<template>
  <div class="about">
    <el-container>
  <el-header>
     <div class="left">
       <img src="https://www.escook.cn/vue-shop/img/heima.b5a855ee.png" alt="" srcset="">
       <h3>电商后台管理系统</h3>
     </div>
     <div class="right">
      <el-button type="info" class="infoBtn" @click="back">退出</el-button>
     </div>
  </el-header>
  <el-container>
    <!-- 左侧 -->
    <el-aside :width="isshow?'200px' :'80px' ">

      <p class="p" @click="isshow=!isshow">|||</p>
    <el-menu
      default-active="2"
      class="el-menu-vertical-demo"
      @open="handleOpen"
      router
      @close="handleClose"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b">
      <el-submenu :index="item.path" v-for="item in cartlist " :key="item.id">
        <template slot="title">
          <i class="el-icon-location"></i>
          <span >{{item.authName}}</span>
        </template>
        <el-menu-item-group>
          <el-menu-item  v-for="el in item.children" :key="el.id" :index="el.path">{{el.authName}}</el-menu-item>
        </el-menu-item-group>
    
      </el-submenu>
    
    </el-menu>

    </el-aside>
    <el-main>
      <!-- 面包屑 -->
       <el-breadcrumb separator="/">
  <el-breadcrumb-item :to="{ path: '/about' }">首页</el-breadcrumb-item>
  <el-breadcrumb-item>{{$route.meta.title}} </el-breadcrumb-item>
</el-breadcrumb>
    <!-- 视图 -->
    <!-- 欢迎~ -->
      <router-view></router-view>
    </el-main>
  </el-container>
</el-container>
  </div>
</template>
<script>
import {getMenus} from "@/utils/api"
export default {
  data() {
    return {
      cartlist:[],
      isshow:true
    }
  },
  methods: {
     handleOpen(key, keyPath) {
        console.log(key, keyPath);
      },
      handleClose(key, keyPath) {
        console.log(key, keyPath);
      },
      back(){
        this.$router.push('/Loginvuex')
      }
  },
  created() {
    getMenus().then(res=>{
      console.log(res);
      this.cartlist=res.data.data
    })
  },
}
</script>

<style lang="scss" scoped>

  .el-header{
    background-color:#373d41;
    color: #ffffff;
    text-align: center;
    height: 8vh;
    padding: 0 25px;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .left{
      display: flex;
      h3{
        font-weight: normal;
        margin: 0 0 0 25px;
        line-height: 56px;
      }
    }

  }
  
  .el-aside {
    background-color: #333744;
    color: #fff;
    text-align: center;
    height: 100vh;
    .p{
      height: 20px;
      padding: 0;
    }
  }
  
  .el-main {
    background-color: #E9EEF3;
    color: #333;
    text-align: center;
    // line-height: 160px;
  }
  
</style>

